package com.coolingme.chatroom;

/**
 * 用户，同事角色
 *
 * @author wangyue
 * @date 2020-09-26 21:53
 */
public class User {

    /**
     * 所属的聊天室
     */
    private ChatRoom chatRoom;

    private String name;


    public User(ChatRoom chatRoom, String name) {
        this.chatRoom = chatRoom;
        this.name = name;
    }

    public String getName() {
        return name;
    }

    /**
     * 发信息
     *
     * @param message 信息
     */
    public void sendMessage(String message) {
        this.chatRoom.showMsg(this, message);
    }

}
